package com.kaili.basic.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.kaili.basic.mapper.MdmOpinionMapper;
import com.kaili.basic.pojo.dto.MdmOpinionQueryDto;
import com.kaili.basic.pojo.entity.*;
import com.kaili.basic.service.IMdmOpinionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by linjian on 19-7-31.
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class MdmOpinionServiceImpl implements IMdmOpinionService {

    @Autowired
    private MdmOpinionMapper mdmOpinionMapper;

    @Override
    public void addOpinion(MdmOpinion opinion) {
        mdmOpinionMapper.insert(opinion);
    }

    @Override
    public List<MdmOpinionExport> opinionInfoExport(MdmOpinionQueryDto dto) {
        return mdmOpinionMapper.opinionInfoExport(dto);
    }

    @Override
    public MdmOpinionEntity queryOpinionById(Integer id) {
        return mdmOpinionMapper.queryOpinionById(id);
    }

    @Override
    public void updateRdStatusById(Integer id) {
        mdmOpinionMapper.updateRdStatusById(id);
    }

    @Override
    public Page<MdmOpinionInfoEntity> getBaseOpinionByCondition(Page<MdmOpinionInfoEntity> page, MdmOpinionQueryDto dto) {
        List<MdmOpinionInfoEntity> list =  mdmOpinionMapper.getBaseOpinionByCondition(page,dto);
        return page.setRecords(list);
    }

    @Override
    public List<MdmBaseMenu> getTreeList() {
        return mdmOpinionMapper.getTreeList();
    }
}
